<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateWangguiDotYhatByMercatorTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wanggui_dot_yhat_by_mercator', function (Blueprint $table) {
            $table->id();
            $table->string('mercatorId', 12)->default('')->comment('网规Mercator坐标');
            $table->unsignedInteger('date')->default(0)->comment('时间');
            $table->decimal('delivery_yhat_lower')->default(0)->comment('外卖预测下限');
            $table->decimal('delivery_yhat_upper')->default(0)->comment('外卖预测上限');
            $table->decimal('delivery_yhat')->default(0)->comment('外卖预测');
            $table->decimal('dine_in_yhat_lower')->default(0)->comment('堂食预测下限');
            $table->decimal('dine_in_yhat_upper')->default(0)->comment('堂食预测上限');
            $table->decimal('dine_in_yhat')->default(0)->comment('堂食预测');
            $table->decimal('total_yhat_lower')->default(0)->comment('总额预测下限');
            $table->decimal('total_yhat_upper')->default(0)->comment('总额预测上限');
            $table->decimal('total_yhat')->default(0)->comment('总额预测');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '墨卡托网规点位预测';

            $table->index(['mercatorId', 'date'], 'idx_mercatorId_data');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wanggui_dot_yhat_by_mercator');
    }
}
